<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-3.2.1.min.js"></script>
    <script>
        function add() {
            $.post("/primaryPost/add",$("#f1").serialize(),function (info) {
                if(info == 'ok'){
                    location.href="index.html";
                }
            });
        }
    </script>
</head>
<body>
    <form id="f1">
        标题：<input type="text" name="title"><br>
        内容：<input type="text" name="content"><br>
        <input type="button" value="添加" onclick="add()">
    </form>
</body>
</html>